/**
 * Project Name:ecsmts_mina
 * File Name:HeartBeatServerHandler.java
 * Package Name:com.aliyun.server.heartbeat
 * Date:2013-7-22下午1:51:30
 * Copyright (c) 2013, 13940488705@163.com All Rights Reserved.
 *
 */

package com.aliyun.server.heartbeat;

import org.apache.mina.core.service.IoHandlerAdapter;
import org.apache.mina.core.session.IdleStatus;
import org.apache.mina.core.session.IoSession;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * ClassName:HeartBeatServerHandler <br/>
 * Function: TODO ADD FUNCTION. <br/>
 * Reason: TODO ADD REASON. <br/>
 * Date: 2013-7-22 下午1:51:30 <br/>
 * 
 * @author zhangfeng
 * @version
 * @since JDK 1.6
 * @see
 */
public class HeartBeatServerHandler extends IoHandlerAdapter {

	private static final Logger LOG = LoggerFactory
			.getLogger(HeartBeatServerHandler.class);

	@Override
	public void exceptionCaught(IoSession session, Throwable cause)
			throws Exception {
		LOG.info("捕获异常");
		cause.printStackTrace();
	}

	@Override
	public void messageReceived(IoSession session, Object message)
			throws Exception {
		LOG.info("receive leaf:  " + (String) message);
	}

	@Override
	public void messageSent(IoSession session, Object message) throws Exception {
		super.messageSent(session, message);
	}

	@Override
	public void sessionClosed(IoSession session) throws Exception {
		LOG.info("session被关闭");
	}

	@Override
	public void sessionIdle(IoSession session, IdleStatus status)
			throws Exception {
		LOG.info("session正空闲" + status.toString());
	}
}
